//package com.feng.oauth2jwt.myauthen;
//
//import com.alibaba.druid.util.StringUtils;
//import org.springframework.security.core.Authentication;
//import org.springframework.security.core.AuthenticationException;
//import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
//import org.springframework.security.web.util.matcher.RequestMatcher;
//
//import javax.servlet.FilterChain;
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.swing.*;
//import javax.swing.text.DefaultEditorKit;
//import java.io.IOException;
//
///**
// * @author feng
// * @description TODO
// * @date 2019/1/17 11:05
// */
//public class MyUsernamePasswordAuth extends AbstractAuthenticationProcessingFilter {
//
//
//    protected MyUsernamePasswordAuth(String defaultFilterProcessesUrl) {
//        super(defaultFilterProcessesUrl);
//    }
//
//    protected MyUsernamePasswordAuth(RequestMatcher requiresAuthenticationRequestMatcher) {
//        super(requiresAuthenticationRequestMatcher);
//    }
//
//    @Override
//    public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException{
//        try {
//            String username = request.getParameter("username");
//            String password = request.getParameter("password");
//            if(StringUtils.isEmpty(username)){
//                throw new Exception("用户名");
//            }
//            if(StringUtils.isEmpty(password)){
//                throw new Exception("mima");
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return null;
//    }
//
//    @Override
//    protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain chain, Authentication authResult) throws IOException, ServletException {
//        super.successfulAuthentication(request, response, chain, authResult);
//    }
//}
